<template>
  <div>
    <h1>元素级的控制</h1>
    {{store.user}}
    <div class="auth-show">
        <div>未做控制,任何人都可可见</div>
        <div>
          <el-button>未做控制,任何人都可可见</el-button>
        </div>
        <div>登录用户可见</div>
        <div>
          <el-button v-auth>登录用户可见</el-button>
          <span v-auth>登录用户可见</span>
        </div>
        <div>admin可见</div>
        <div>
          <el-button v-roles="'admin'">admin可见</el-button>
          <span  v-roles="'admin'">admin可见</span>
        </div>
        <div>vip可见</div>
        <div>
          <el-button v-roles="'vip'">vip可见</el-button>
          <span  v-roles="'vip'">vip可见</span>
        </div>
        <div>admin和vip可见</div>
        <div>
          <el-button v-roles="['admin','vip']">admin和vip可见</el-button>
          <span  v-roles="['admin','vip']">admin和vip可见</span>
        </div>
      </div>
  </div>
</template>
<script setup>
import {userStore} from "@/store/user";
const store = userStore();
</script>
<style scoped>
.auth-show {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr 1fr;
  padding: 2rem 0;
  margin: 2rem 0;
  border-top: solid 2px var(--el-color-primary) ;
}
.auth-show>:nth-child(2n+1){
  display: flex;
  justify-content: flex-end;
  align-items: center;
}
</style>